/**
 * 
 */
package com.thor.palmmall.dao.elecharges.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.util.converter.OperateInfoConverter;
import com.thor.palmmall.api.elecharges.EleChargesBill;
import com.thor.palmmall.dao.elecharges.PEleChargesBill;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class PEleChargesBillConverter implements Converter<PEleChargesBill, EleChargesBill> {

  public static PEleChargesBillConverter getInstance() {
    if (instance == null)
      instance = new PEleChargesBillConverter();
    return instance;
  }

  private static PEleChargesBillConverter instance;

  private PEleChargesBillConverter() {
  }

  @Override
  public EleChargesBill convert(PEleChargesBill source) {
    if (source == null) {
      return null;
    }
    EleChargesBill target = new EleChargesBill();
    target.inject(source);
    target.setActionTime(source.getActionTime());
    target.setAmount(source.getAmount());
    target.setBillNumber(source.getBillNumber());
    target.setCreateInfo(OperateInfoConverter.getInstance().convert(source.getCreateInfo()));
    target
        .setLastModifyInfo(OperateInfoConverter.getInstance().convert(source.getLastModifyInfo()));
    target.setUserNumber(source.getUserNumber());
    target.setMethod(source.getMethod());
    target.setState(source.getState());
    target.setRemark(source.getRemark());
    target.setTransactioNo(source.getTransactioNo());
    target.setVersion(source.getVersion());
    target.setBuyerLogonId(source.getBuyerLogonId());
    target.setBuyerPayAmount(source.getBuyerPayAmount());
    target.setInvoiceAmount(source.getInvoiceAmount());
    target.setReceiptAmount(source.getReceiptAmount());
    target.setSellerEmail(source.getSellerEmail());
    target.setErrMsg(source.getErrMsg());
    target.setNotifyFlag(source.getNotifyFlag());
    target.setPayCardNo(source.getPayCardNo());
    return target;
  }

}
